use crate::types::ZIndex;
#[derive(thiserror::Error, Debug, Clone)]
#[error("out of range: {name}({index}) is not supported on `{program}`")]
pub struct OutOfRangeError {
pub name: String,
pub index: ZIndex,
pub program: super::VoicemeeterApplication,
}
#[derive(thiserror::Error, Debug, Clone)]
#[error("invalid device: {device:?} is not supported on `{program}`")]
#[non_exhaustive]
pub struct DeviceError {
pub program: super::VoicemeeterApplication,
pub device: crate::types::Device,
}
#[derive(thiserror::Error, Debug, Clone)]
#[non_exhaustive]
pub enum InvalidTypeError {
#[error(
"{name}[{strip_index}] needs to be a physical {name} for access to parameter `{parameter}`"
)]
ExpectedPhysical {
name: &'static str,
strip_index: ZIndex,
parameter: String,
},
#[error(
"{name}[{strip_index}] needs to be a virtual {name} for access to parameter `{parameter}`"
)]
ExpectedVirtual {
name: &'static str,
strip_index: ZIndex,
parameter: String,
},
#[error("expected a strip, got `{device}`")]
ExpectedStrip {
device: String,
},
#[error("expected a bus, got `{device}`")]
ExpectedBus {
device: String,
},
}
#[derive(thiserror::Error, Debug, Clone)]
#[error("{parameter} requires programs {expected:?} to be accessed, program is {found}")]
pub struct InvalidVoicemeeterVersion {
pub expected: &'static [super::VoicemeeterApplication],
pub found: super::VoicemeeterApplication,
pub parameter: String,
}
#[derive(thiserror::Error, Debug, Clone)]
pub enum ParameterError {
#[error(transparent)]
Version(#[from] InvalidVoicemeeterVersion),
#[error(transparent)]
Type(#[from] InvalidTypeError),
#[error(transparent)]
OutOfRange(#[from] OutOfRangeError),
#[error(transparent)]
Device(#[from] DeviceError),
}